import request from '@/utils/request'

export function getList(data) {
  let url = 'api/recipel/getPrescriptions'
  const param = _getParams(data)
  if (param) url = url + '?' + param
  return request({
    url: url,
    method: 'get'
  })
}

export function confirmOrder(id) {
  return request({
    url: 'api/prescription/confirmOrder?id=' + id,
    method: 'post'
  })
}

const _getParams = function(data) {
  if (!data) return null
  let res = ''
  for (const key in data) {
    res += '&' + key + '=' + data[key]
  }
  return res.substring(1)
}

